<template>
<div class="wrapper tag-item"> 
   <div class="job-intro"> 
    <div class="left-img"> 
     <img src="~/assets/img/widget-company.png" alt="" /> 
    </div> 
    <div class="middle-intro"> 
     <div class="name">
     {{rItem.jobname}} &middot; {{eItem.name}}
     </div> 
     <div class="intro">
      15K-25K / 经验3-5年 / 本科及以上 / 全职
     </div> 
     <div class="tag"> 
      <li>Python</li>
      <li>Python</li>
      <li>O2O</li>
      <li>Python</li>
      <li>Python</li> 
     </div> 
    </div> 
    <div class="right-tool"> 
     <p class="throw"><button class="sui-btn btn-throw">投简历</button></p> 
     <button class="sui-btn btn-collect">收藏</button> 
     <span>100收藏</span> 
     <span>291浏览</span> 
    </div> 
    <div style="clear:both"></div> 
   </div> 
   <div class="fl left-list "> 
    <div class="tit"> 
     <span>职位描述</span> 
    </div> 
    <div class="content"> 
        {{rItem.content1}}
    </div> 
    <div class="tit"> 
     <span>职位要求</span> 
    </div> 
    <div class="content"> 
        {{rItem.content2}}
    </div> 
    <div class="time">
     发布于1小时前
    </div> 
   </div> 
   <div class="fl right-tag"> 
    <div class="company-job"> 
     <div class="intro"> 
      <img :src="`${eItem.logo}`" alt="" /> 
      <div class="title">
      {{eItem.name}}
      </div> 
      <div class="content">
       {{eItem.summary}}
      </div> 
     </div> 
     <div class="tag"> 
      <li v-for="(item,index) in eItem.labels.split(',')" :key="index">{{item}}</li> 

     </div> 
     <div class="btns"> 
      <a class="sui-btn btn-home" href="~/assets/recruit-company.html" target="_blank">企业主页</a> 
      <a class="sui-btn btn-position" href="~/assets/recruit-job.html" target="_blank">1个职位</a> 
     </div> 
    </div> 
   </div> 
  </div> 
</template>

<script>
import enterpriseApi from "~/api/enterprise"
import recruitApi from "~/api/recruit"
import "~/assets/css/page-sj-recruit-detail.css"
export default {
    asyncData(context) {
        //获取招聘id
        let id = context.params.id;
        //根据id查询招聘信息
       return  recruitApi.findById(id).then(res => {
            let eid = res.data.data.eid
            //根据招聘信息中的eid查询企业详情
           return enterpriseApi.findById(eid).then(res2 => {
               // console.log(res2.data)
               return {
                   rItem:res.data.data,  //招聘详情
                   eItem:res2.data.data//企业详情
               }
            })
        })
    }
}
</script>

<style>

</style>
